package cn.service.impl;

import cn.entity.WorkOrder;
import cn.mapper.WorkOrderMapper;
import cn.service.WorkOrderService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional //开启事务
public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrder> implements WorkOrderService {

    @Autowired
    WorkOrderMapper workOrderMapper;

    @Override
    public PageInfo<WorkOrder> selectPage(int pageNum, int pageSize, Map<String, Object> map) {
        PageHelper.startPage(pageNum,pageSize);
        List<WorkOrder> workOrders = workOrderMapper.selectPage(map);
        return new PageInfo<WorkOrder>(workOrders,4);
    }

    @Override
    public Map<String, Object> showDetail(Long id) {
        return workOrderMapper.showDetail(id);
    }
}
